package net.zoneland.zrdp.biz.enums;

import org.apache.commons.lang.StringUtils;

import com.richercloud.lift.lang.enums.ValueOf;

import lombok.AllArgsConstructor;
import lombok.Getter;
import net.zoneland.zrdp.common.enums.BaseEnum;

/**
 * 指标数据中对应的地市公司名称.
 * @author Pbody
 **/
@Getter
@AllArgsConstructor
public enum IndicatorCityEnum implements BaseEnum<String> {

    ALL_PROVINCE("全省", "provinceAll" ),
    HZ("杭州", "hz"),
    NB("宁波", "nb"),
    WZ("温州", "wz"),
    TZ("台州", "tz"),
    JH("金华", "jh"),
    SX("绍兴", "sx"),
    JX("嘉兴", "jx"),
    HU("湖州", "hu"),
    QZ("衢州", "qz"),
    LS("丽水", "ls"),
    ZS("舟山", "zs"),
    ;

    /** 枚举值：省/地市公司DN. **/
    private final String name;
    /** 枚举名称：省/地市公司名称. **/
    private final String value;

    /** 地市名称. */
    private static final ValueOf<IndicatorCityEnum, String> BY_VALUE = new ValueOf<>(IndicatorCityEnum.class, IndicatorCityEnum::getValue);


    /**
     * 获取地市名称.
     * @author helu
     * @Date 15:12 2023/11/2
     * @param value 地市简称
     * @return 地市名称
     **/
    public static String getNameByValue(final String value) {
        return BY_VALUE.valueOf(value)
            .map(IndicatorCityEnum::getName)
            .orElse(StringUtils.EMPTY);
    }
}
